package mws;


import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class ThreadPoolUtil {
    @SuppressWarnings("uncheck")
    public static ThreadPoolExecutor createThreadPoolExecutor(ThreadPoolProperty threadPoolProperty) {





        return new ThreadPoolExecutor(
                threadPoolProperty.getCorePoolSize(),
                threadPoolProperty.getMaxPoolSize(),
                threadPoolProperty.getKeepAliveSeconds() ,
                TimeUnit.SECONDS,
                new SwiftBlockingQueue<Runnable>(BlockingQueueFactory::createLinkedBlockingQueue, threadPoolProperty.getQueueCapacity() ),
                new ThreadFactoryBuilder()
                        .setNamePrefix(threadPoolProperty.getThreadNamePrefix())
                        .build()
        );
    }

    //public abstract class IdempotentConfigurationSupport {
//}
}
